package com.futureCloudMOM.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.futureCloudMOM.core.base.service.impl.BaseServiceImpl;
import com.futureCloudMOM.core.domain.FacilityResourceDetail;
import com.futureCloudMOM.core.service.FacilityResourceDetailService;
import com.futureCloudMOM.core.mapper.FacilityResourceDetailMapper;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 【Facility_ResourceDetail】的数据库操作Service实现
*
* @author Administrator
* @since 2023-06-06 15:19:30
*/
@Service
public class FacilityResourceDetailServiceImpl extends BaseServiceImpl<FacilityResourceDetailMapper, FacilityResourceDetail> implements FacilityResourceDetailService{

    @Override
    public List<FacilityResourceDetail> getListByNameAndCode(FacilityResourceDetail detail) {
        return list(new LambdaQueryWrapper<FacilityResourceDetail>()
        .eq(FacilityResourceDetail::getDeleted,0)
        .like(ObjectUtils.isNotEmpty(detail.getFacilityName()),FacilityResourceDetail::getFacilityName,detail.getFacilityName())
        .like(ObjectUtils.isNotEmpty(detail.getFacilityCode()),FacilityResourceDetail::getFacilityCode,detail.getFacilityCode())
        .orderByDesc(FacilityResourceDetail::getSysCreateTime)
        );
    }
}
